/*
 * @Author: zheguo 3188606474@qq.com
 * @Date: 2024-04-19 09:29:08
 * @LastEditors: zheguo 3188606474@qq.com
 * @LastEditTime: 2024-04-19 19:06:14
 * @FilePath: \ProjectAction\express-app\models\index.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * 
 */
/*
 * @Author: zheguo 3188606474@qq.com
 * @Date: 2024-04-19 09:29:08
 * @LastEditors: zheguo 3188606474@qq.com
 * @LastEditTime: 2024-04-19 09:37:18
 * @FilePath: \ProjectAction\express-app\models\index.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const Sequelize = require('sequelize')

const dbConfig = require("../config/db.config")

const sequelize = new Sequelize(
    dbConfig.DB,
    dbConfig.USER,
    dbConfig.PASSWORD,
    {
        host: dbConfig.HOST,
        dialect: dbConfig.dialect
    }
);

const db = {}
db.sequelize = sequelize
db.Sequelize = Sequelize
// 在数据库中创建表格
// db.tutorrials = require("./turtorial.model")(sequelize, Sequelize)
// db.tests = require("./test.model")(sequelize, Sequelize)

db.users = require("./user/user.model")(sequelize, Sequelize)
db.admins = require("./admin/admin.model")(sequelize, Sequelize)
db.commoditys = require("./commodity/commodity.model")(sequelize, Sequelize)
db.channels = require("./commodity/channels.model")(sequelize, Sequelize)
db.swipers = require("./commodity/swiper.model")(sequelize, Sequelize)
db.messages = require("./message/message.model")(sequelize, Sequelize)
db.logs = require("./log/log.model")(sequelize, Sequelize)
db.messageBoards = require("./messageBoard/messageBoard.model")(sequelize, Sequelize)
module.exports = db